// 模板管理
import request from '@/utils/request'
import APIurl from '@/api/apiUrl/index.js'
import { serviceDownLoad } from '@/utils/request'
// 新增模板表数据
export function templateAdd(params) {
  return request({
    url: APIurl.reportTemplateController.add,
    method: 'post',
    data: params
  })
}
// 删除模板表数据
export function templateDelete(params) {
  return request({
    url: APIurl.reportTemplateController.delete + '?tmplId=' + params,
    method: 'post'
    // data: params
  })
}
// 查询所有模板表数据
export function templateGetAll(params) {
  return request({
    url: APIurl.reportTemplateController.getAll,
    method: 'post',
    data: params
  })
}
// 查询分页模板表数据
export function templateGetAllPage(params) {
  return request({
    url: APIurl.reportTemplateController.getAllPage,
    method: 'post',
    data: params
  })
}
// 更新模板表数据
export function templateUpdate(params) {
  return request({
    url: APIurl.reportTemplateController.update,
    method: 'post',
    data: params
  })
}
// jasper 打印预览
export function previewTmpl(params) {
  return request({
    url: APIurl.reportTemplateController.previewTmpl,
    method: 'post',
    data: params
  })
}
// jasper pdf打印预览
export function templatePreview(params) {
  return request({
    url: APIurl.reportTemplateController.preview,
    method: 'post',
    data: params
  })
}
// 查询模板详细信息数据
export function templateGetReportTmplDetail(params) {
  return request({
    url: APIurl.reportTemplateController.getReportTmplDetail,
    method: 'post',
    data: params
  })
}
// jasper文件上传
export function templateUpload(params) {
  return request({
    url: APIurl.reportTemplateController.upload,
    method: 'post',
    data: params
  })
}
// 模板文件下载
export function templDownload(params) {
  return serviceDownLoad({
    url: APIurl.reportTemplateController.download,
    method: 'post',
    data: params
  })
}
// 预览模板
export function printTmpl(params) {
  return request({
    url: APIurl.reportTemplateController.printTmpl,
    method: 'get',
    params: params
  })
}
// 获取默认设置
export function getUserPara() {
  return request({
    url: APIurl.reportTemplateController.getUserPara,
    method: 'get'
  })
}
export default{
  templDownload, templateAdd, templateDelete, templateGetAll, templateGetAllPage, templateUpdate, templatePreview, templateGetReportTmplDetail, templateUpload,
  previewTmpl, printTmpl, getUserPara
}
